package com.hs.sfzy.service.impl;

import com.hs.sfzy.mapper.ConsultSpecialtyMapper;
import com.hs.sfzy.service.ConsultSpecialtyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ConsultSpecialtyServiceImpl
 * @Description TODO
 * @Author 李明辉
 * @Date 2024年10月25日 9:13
 * @Version 1.0
 */
@Service
public class ConsultSpecialtyServiceImpl implements ConsultSpecialtyService {
    @Autowired
    private ConsultSpecialtyMapper consultSpecialtyMapper;
    @Override
    public void updateSpecialtyByConsultId(Long consultId, List<Long> specialtyIds) {
//        删除旧的数据
        consultSpecialtyMapper.deleteSpecialtyByConsultId(consultId);
//        插入新的记录
        if (specialtyIds!=null&&!specialtyIds.isEmpty()){
            consultSpecialtyMapper.insertSpecialty(consultId,specialtyIds);
        }
    }
}
